<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="" method="post"> 
		<input type=text name="a" value="">x<sup>2</sup>+ 
		<input type=text name="b" value="">x+ 
		<input type=text name="c" value="">=0 
		<input type=submit value="求解" >
	</form> 
	<%
		String sa = request.getParameter("a");
		String sb = request.getParameter("b");
		String sc = request.getParameter("c");
		double a, b, c;
		if(sa != null && sa.length() > 0)
			a = Double.parseDouble(sa);
		else
			a = 0;
		if(sb != null && sb.length() > 0)
			b = Double.parseDouble(sb);
		else
			b = 0;
		if(sc != null && sc.length() > 0)
			c = Double.parseDouble(sc);
		else
			c = 0;
		double deta = b*b - 4*a*c;
		if(deta > 0) {
			double x1 = (-b - deta) / (2*a);
			double x2 = (-b + deta) / (2*a);
			out.print("x1 = " + x1 + "; x2 = " + x2);
		} else if(deta == 0) {
			double x = -b / (2*a);
			out.print("x = " + x);
		} else
			out.print("none");
	%>
</body>
</html>